<?php $id="form_".uniqid();?>
<table id="<?php echo $id;?>"></table>
<script>
    $("#<?php echo $id;?>").DataSource({url:'cash/getlist',
        fields:[[
            {field:'id',      title:'ID', align:'center',width:100,sortable:true},
            {field:'user',  title:'用户名【次数】', align:'center',width:150, sortable:true},
            {field:'coupon_sn',  title:'优惠卡号', align:'center',width:150, sortable:true},
            {field:'charge_pwd',  title:'充值密码', align:'center',width:150, sortable:true},
            {field:'charge_money',title:'充值金额', align:'center',width:150,  sortable:true},
            {field:'charge_date',title:'充值日期',  align:'center',width:150,  sortable:true},
            {field:'charge_ip',    title:'充值IP【次数】',  align:'center',width:150,  sortable:true},
            {field:'op', title:'操作',  width:250,  align:'center',sortable:true, formatter:function(v,r){
                return '<a herf="#" class="btn btn-danger btn-xs" onclick=ip_op()>封IP</a>&nbsp;&nbsp;'+
                    '<a herf="#" class="btn btn-danger btn-xs" onclick=user_op()>封用户</a>&nbsp;&nbsp;'+
                    '<a herf="#" class="btn btn-danger btn-xs" onclick=ip_op()>解封IP</a>&nbsp;&nbsp;'+
                    '<a herf="#" class="btn btn-danger btn-xs" onclick=user_op()>解封用户</a>&nbsp;&nbsp;';
            }}

        ]], tools:[
            {instant:false},
            <?php if(in_array('ADD',$auth)){?>
            {text:"设置",iconCls:"icon-edit",handler:function(){
                Core.dialog('优惠卡设置', 'cash/coupon_edit', function(){}, true, '20%');
            }},
            <?php } ?>
            '|',
                {type:'combobox',text:'类型',width:100,name:'type',value:'', items:'<option value="1">用户名</option><option value="2">优惠卡号</option><option value="3">充值过的IP</option>'},
                {type:'textbox', text:'', width:100,name:'username'},
                {type:'combobox',text:'使用情况',width:100,name:'type',value:'', items:'<option value="1">已使用</option><option value="2">未使用</option>'},
                {type:'combobox',text:'编号',width:100,name:'type',value:'', items:'<option value="1">1701</option><option value="2">1702</option><option value="3">1703</option>'},
                {type:'datebox', text:'充值日期',   width:100,name:'qaddtime'},
                {type:'datebox', text:'-',     width:100,name:'zaddtime'},
                {text:"搜索", iconCls:"icon-search", handler:function(){
                    $('#<?php echo $id?>').DataSource('search');
                }},
            '-'
        ],
        checkbox:false,
        footer:true,
        success:function(){

        }
    });

    function user_op()
    {
        
    }
    
    function ip_op()
    {
        alert('hello');
    }
</script>